PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Open

Open is an application command that opens a file or files.

SYNTAX
open referenceToFile
PARAMETER
referenceToFile
A reference of the form file nameString or alias nameString , or a list of such references (see "Notes"). Class: Reference or list of references
RESULT

None

EXAMPLES

Open a single file.

tell application "AppleWorks"
    open file "Hard Disk:New Products:Mammoth:Product Intro"
end tell

Open a list of files.

tell application "AppleWorks"
    open {file "Hard Disk:Letters:Offer", ¬
        file "Hard Disk:Letters:Acceptance"}
end tell

Ask the Finder to open an Apple System Profiler report file. This is the equivalent of double-clicking on a file icon in the Finder, and launches the application if it isn't already running.

tell application "Finder"
    open the file "Control Panel Report" of disk "Hard Disk"
end tell
NOTES

To specify the name ( nameString ) of a file to open, use a string of the form " Disk : Folder1 : Folder2 :...: Filename " ; for details, see References to Files. You can also specify a string with only a filename (" Filename "). In this case, the application attempts to find the file in the current directory. (The current directory is typically the directory where the application was launched, the directory where the application last opened or saved a previous document, or another directory specified by the application. The current directory may be affected by settings in the General Controls control panel.)

If the file or files specified by referenceToFile is already open, it remains open and, typically, becomes the frontmost window (if it was not already).


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)